<form enctype="multipart/form-data" method="post">
	<input type="text" size="25" name="txtimg" />
    <input type="submit" name="btok" value="GET IMAGE" />
</form>
<?php
	$conn=mysql_connect("localhost","root","");
	mysql_select_db("phimsot",$conn);
	mysql_set_charset("utf-8",$conn);
	
	function GetFileExt($strFileName){ return strtolower(substr(strrchr($strFileName, '.'), 1));}
	if(isset($_POST['btok'])){$url = $_POST['txtimg'];
	if($data_s=file_get_contents($url,0))
	{
		$name=rand(1,1000).".".GetFileExt($url);
		$path="img/".$name;
	}
	}
	
?>